package com.laboratory.eventlistenerlearning.service;

import com.laboratory.eventlistenerlearning.event.DeptEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;

@Service
public class DeptService {

    @Autowired
    private ApplicationEventPublisher applicationEventPublisher;

    public void addDept() {
        /**
         * 部门事件发布器
         */
        applicationEventPublisher.publishEvent(new DeptEvent(this, "add dept success", "add dept success"));
    }

}
